Skip to content

Conversation

@HammadB
Copy link
Collaborator

@HammadB HammadB commented Dec 4, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • /
  • New functionality
    • Adds read level to the query nodes. When read level is IndexAndWal it reads both indexAndWal, IndexOnly skips the Wal. This is a simple change in the orchestrator.

Test plan

How are these changes tested?
Tests will be handled e2e at the top of the stack in client changes

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Migration plan

This param will default to IndexAndWal to preserve existing behavior.

Observability plan

Added trace to log this is being used. In conjuction with #6077 this should be sufficient.

Documentation Changes

Updated relevant code docs

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link
Collaborator Author

HammadB commented Dec 4, 2025

@HammadB HammadB changed the title add frontend compile [ENH] Eventual consistency in query nodes Dec 4, 2025
@HammadB HammadB force-pushed the hammad/eventual_consistency_query branch from 542b0a4 to a4bcf3a Compare January 9, 2026 16:12
@HammadB HammadB marked this pull request as ready for review January 9, 2026 16:49
@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Jan 9, 2026

Add query ReadLevel support with WAL-skipping option

Introduces a ReadLevel enum across proto, type conversions, and worker orchestration to let search/KNN queries choose between reading both index and WAL (IndexAndWal) versus index-only (IndexOnly). The worker KnnFilterOrchestrator now respects this flag, skipping log fetches and piping empty logs when IndexOnly is requested, while server/front-end flows continue to default to full consistency. Bench harnesses and supporting constructors were updated to pass the new argument, and a trace log was added when skipping WAL.

Key Changes

• Defined ReadLevel enum in idl/chromadb/proto/query_executor.proto, added read_level field to SearchPlan, and propagated conversion helpers in rust/types/src/execution/plan.rs.
• Extended KnnFilterOrchestrator (and related constructors/benches) with a stored read_level, routing initial task scheduling to skip WAL fetches for ReadLevel::IndexOnly while reusing a new helper to build filter tasks.
• Plumbed read_level through rust/worker/src/server.rs search orchestration APIs, defaulting to ReadLevel::IndexAndWal when unspecified, and ensured KNN/bench call sites pass the new parameter.
• Frontend service keeps defaulting Search requests to ReadLevel::IndexAndWal, preserving current consistency semantics until client requests supply another value.

Affected Areas

idl/chromadb/proto/query_executor.proto
rust/types/src/execution/plan.rs
rust/worker/src/execution/orchestration/knn_filter.rs
rust/worker/src/server.rs
rust/frontend/src/impls/service_based_frontend.rs
rust/worker/benches/query.rs

This summary was automatically generated by @propel-code-bot

collection_and_segments,
},
payloads: request.searches,
read_level: ReadLevel::IndexAndWal,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

[Requirements] read_level is hardcoded to IndexAndWal here. This prevents clients from utilizing the new IndexOnly functionality even if the backend supports it.

If request (of type SearchRequest) exposes a read_level preference, it should be mapped here. If SearchRequest does not yet support this field, this limitation should be tracked.

Context for Agents
`read_level` is hardcoded to `IndexAndWal` here. This prevents clients from utilizing the new `IndexOnly` functionality even if the backend supports it. 

If `request` (of type `SearchRequest`) exposes a `read_level` preference, it should be mapped here. If `SearchRequest` does not yet support this field, this limitation should be tracked.

File: rust/frontend/src/impls/service_based_frontend.rs
Line: 1837

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is deliberate and handled up-stack

match self.read_level {
ReadLevel::IndexOnly => {
// For IndexOnly queries, skip log fetching and use empty logs
tracing::info!("Skipping log fetch for IndexOnly read level");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommended

[Maintainability] Using tracing::info! in the query execution path will generate excessive logs in high-throughput scenarios (one log per query). Consider using tracing::debug! or tracing::trace! instead to reduce noise.

Context for Agents
Using `tracing::info!` in the query execution path will generate excessive logs in high-throughput scenarios (one log per query). Consider using `tracing::debug!` or `tracing::trace!` instead to reduce noise.

File: rust/worker/src/execution/orchestration/knn_filter.rs
Line: 302

@HammadB HammadB requested a review from Sicheng-Pan January 9, 2026 17:51
.scan
.ok_or(Status::invalid_argument("Invalid Scan Operator"))?;
let read_level: ReadLevel = chroma_proto::ReadLevel::try_from(search_plan.read_level)
.unwrap_or(chroma_proto::ReadLevel::IndexAndWal)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^


// ReadLevel specifies which data sources to read from during queries.
// This affects consistency vs performance tradeoffs.
enum ReadLevel {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ReadLevel feels unclear to me, is there a use case for this other than toggling whether to read logs or not

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was "eventual_consistency" before. I went back and forth on many names. I think its the clearest one I can generate that is clear, specific, and correct in its use of terms.

Databases often offer "levels" to a read but we are devoid of any formal naming here, so I prefer to be explicit in IndexOnly vs IndexAndWal. Then the question is what to call those options. If its "ConsistencyLevel" I'd expect formal notions of consistency not wishy-washy ones like what we are offering. The reason to make it an enum is we can offer BoundedConsistency in the future.

Copy link
Contributor

@Sicheng-Pan Sicheng-Pan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@HammadB HammadB enabled auto-merge (squash) January 9, 2026 18:10
@HammadB HammadB disabled auto-merge January 9, 2026 18:11
@HammadB HammadB force-pushed the hammad/eventual_consistency_query branch from 352c0f5 to 691f8b1 Compare January 9, 2026 18:15
@HammadB HammadB enabled auto-merge (squash) January 9, 2026 18:20
@HammadB HammadB merged commit 584a131 into main Jan 9, 2026
126 of 128 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants